
class Player:

    #Takes an unorthodox and ungame-theory method of play, most likely simpler than most other players
    #By looking at when players hunt with you and when they don't, this class attempts to find the average "acceptance" reputation
    #Once this is approximated it keeps the reputation above it and hunts/slacks accordingly
    #Some small adjustments were based on trial and error against many simulated opponents on a PyGame made graph added to the available code tester
    
    def __init__(self):
        self.liked = 0 #Used to measure amount of times hunted with
        self.hated = 0 #Used to measure amount of times not hunted with
        self.cycle = 0 #Cycles used to change when it is getting the average accepted reputation and when it is increasing reputation
        self.currep = 0 #Used to store a reputation beyond one cycle
    
    def hunt_choices(self,round_number,current_food,current_reputation,m,player_reputations):
        
        if self.cycle == 0: 
            self.currep = current_reputation #keeps the reputation for the following cycles

        #----Below this is line calculates the approximate desire rate --------
        try:
            self.rate = float(float(self.liked)-float(self.hated))/(float(len(player_reputations))*1.5)
        except:
            self.rate = 0

        self.rate = (self.rate - (self.rate*0.4)) - 0.2
        self.liked = 0
        self.hated = 0
        #----------------------------------------------------------------------
        
        dec = []#stores the decisions made against each opponent

        if self.cycle == 0 or round_number < 140: #moves player reputation to the accepted range
            for hunt in player_reputations:
                if self.rate < 0:
                    dec.append('h')
                else:
                    dec.append('s')
        else: #moves player reputation above accepted range
            for hunt in player_reputations:
                if current_reputation < self.currep * 1.03: #self.currep is the accepted rate, so this moves the current reputation above that numeber 
                    dec.append('h')
                else:
                    dec.append('s')
                    
        self.cycle += 1 #advances cycles
        if self.cycle == 3:
            self.cycle = 0
            
        return dec
    
    def hunt_outcomes(self, food_earnings):
        #This counts the amount of times that opponents hunted or didn't hunt based on the "food_earnings" matrix
        for op in food_earnings:
            if op == 0 or op == 1:
                self.liked += 1
            else:
                self.hated += 1
        self.liked -= self.liked*0.01 #adjustment
        self.hated += self.hated*0.01 #adjustment

    def round_end(self, award, m, number_hunters):
        pass
